package com.demo2do.fms.entity.authority;

import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;

import com.demo2do.core.format.PersistentFormat;

/**
 * 运输公司
 * 
 * @author Ysy
 *
 */
@Entity
@Table(name = "VW_TRANSPORTATION_COMPANY")
@PersistentFormat
public class Organization {

    @Id
    @GeneratedValue(generator = "generator")
    @GenericGenerator(name = "generator", strategy = "assigned")
    private Long id;
    
    @Column(name = "ORGANIZATION_CODE")
    private String code;
    
    @Column(name = "ORGANIZATION_NAME")
    private String name;
    
    @Column(name = "IS_INTERNAL")
    private Boolean internal;
    
    @Column(name = "IS_DISABLED")
    private Boolean disabled;
    
    @Column(name = "IS_SYSTEM")
    private Boolean system;
    
    /**
     * 
     * the default constructor
     */
    public Organization() {
    }
    
    /**
     * @param id
     */
    public Organization(Long id) {
        this.id = id;
    }
    
    /**
     * 
     * @param userSupplierIds
     * @return
     */
    public boolean belongs(List<Long> userSupplierIds){
        return userSupplierIds.contains(this.getId());
    }
    
    /**
     * @return the id
     */
    public Long getId() {
        return id;
    }

    /**
     * @return the code
     */
    public String getCode() {
        return code;
    }

    /**
     * @return the name
     */
    public String getName() {
        return name;
    }

    /**
     * @return the internal
     */
    public Boolean getInternal() {
        return internal;
    }

    /**
     * @return the disabled
     */
    public Boolean getDisabled() {
        return disabled;
    }

    /**
     * @return the system
     */
    public Boolean getSystem() {
        return system;
    }

    /**
     * @param id the id to set
     */
    public void setId(Long id) {
        this.id = id;
    }

    /**
     * @param code the code to set
     */
    public void setCode(String code) {
        this.code = code;
    }

    /**
     * @param name the name to set
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * @param internal the internal to set
     */
    public void setInternal(Boolean internal) {
        this.internal = internal;
    }

    /**
     * @param disabled the disabled to set
     */
    public void setDisabled(Boolean disabled) {
        this.disabled = disabled;
    }

    /**
     * @param system the system to set
     */
    public void setSystem(Boolean system) {
        this.system = system;
    }
}
